package main

import (
	"fmt"
	"strings"
)

func main() {
	//写一个程序，统计一个字符串中每个单词出现的次数。比如：“how do you do”中how=1 do=2 you=1
	var str = "how do you do"
	var str_arr = strings.Split(str, " ")
	fmt.Println(str_arr)

	var key = make(map[string]int)
	for _, v := range str_arr {
		//_, isKey := key[v]
		//if !isKey {
		//	key[v] = 1
		//} else {
		//	key[v] = key[v] + 1
		//}

		key[v]++
	}

	fmt.Println(key)
}
